let { Schema, model } = require('mongoose')
let moment =require('moment');
//设置数据集合的结构
let  studentsShemas = new Schema({
  name: String,
  id: String,
  age: String,
  sex: String,
  username: String,
  imageName: String,
  password:{
    type: String,
    default: '123'
  },
  time:{
    type: String,
    default: moment().format('YYYY年MM月DD日 HH:mm')
  },
  classId:{
       type: Schema.Types.ObjectId, //关联的模型id
       ref: 'classes'
  },
  
  courseId:[{
      type: Schema.Types.ObjectId,
      ref: 'course'
  }],
  teacherId: {
    type: Schema.Types.ObjectId, //关联的模型id
    ref: 'teacher'
  }
},{versionKey:false});
//设置数据集合的模型
let  students = model("students", studentsShemas, 'students')
module.exports.students=students;